home *** CD-ROM | disk | FTP | other *** search
/ Computer Inter@ctive 17 / Computer Interactive cdrom 17 - gen 99.iso / ZDNETIT / CONTENT / SMTPCEMS.ZIP / SEE4C_R.TXT < prev    next >
Encoding:
Text File  |  1998-11-15  |  38.0 KB  |  1,322 lines

  1.  
  2.  
  3.  
  4.  
  5.                          SMTP/POP3 Email Engine
  6.  
  7.                            Library for C/C++
  8.  
  9.                                  (SEE4C)
  10.  
  11.  
  12.                             REFERENCE MANUAL
  13.  
  14.  
  15.  
  16.                                Version 2.1
  17.  
  18.                             November 14, 1998
  19.  
  20.  
  21.  
  22.  
  23.                      This software is provided as-is.
  24.               There are no warranties, expressed or implied.
  25.  
  26.  
  27.  
  28.  
  29.                            Copyright (C) 1998
  30.                            All rights reserved
  31.  
  32.  
  33.  
  34.                        MarshallSoft Computing, Inc.
  35.                            Post Office Box 4543
  36.                            Huntsville AL 35815
  37.  
  38.  
  39.                            Voice : 256-881-4630
  40.                              FAX : 256-880-0925
  41.                            email : info@marshallsoft.com
  42.                              web : www.marshallsoft.com
  43.  
  44.                                _______
  45.                           ____|__     |                (R)
  46.                        --+       |    +-------------------
  47.                          |   ____|__  |  Association of
  48.                          |  |       |_|  Shareware
  49.                          |__|   o   |    Professionals
  50.                        --+--+   |   +---------------------
  51.                             |___|___|    MEMBER
  52.  
  53.  
  54.       MARSHALLSOFT is a registered trademark of MarshallSoft Computing.
  55.  
  56.  
  57.  
  58.  
  59.  
  60.      SEE4C Reference Manual                                    Page 1
  61.  
  62.                             C O N T E N T S
  63.  
  64.  
  65.  
  66.         Chapter                                     Page
  67.  
  68.         Table of Contents.............................2
  69.  
  70.         General Remarks...............................3
  71.  
  72.         SEE Functions.................................3
  73.  
  74.            seeClose...................................3
  75.  
  76.            seeDebug...................................4
  77.  
  78.            seeDecodeBuffer............................5
  79.  
  80.            seeDeleteEmail.............................6
  81.  
  82.            seeDriver..................................7
  83.  
  84.            seeEncodeBuffer............................8
  85.  
  86.            seeErrorText...............................9
  87.  
  88.            seeExtractText............................10
  89.  
  90.            seeGetEmailCount..........................11
  91.  
  92.            seeGetEmailFile...........................12
  93.  
  94.            seeGetEmailLines..........................13
  95.  
  96.            seeGetEmailSize...........................14
  97.  
  98.            seeIntegerParam...........................15
  99.  
  100.            seePop3Connect............................16
  101.  
  102.            seeSendEmail..............................17
  103.  
  104.            seeSmtpConnect............................18
  105.  
  106.            seeStatistics.............................19
  107.  
  108.            seeStringParam............................20
  109.  
  110.            seeVerifyFormat...........................21
  111.  
  112.            seeVerifyUser.............................22
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.      SEE4C Reference Manual                                    Page 2
  121.  
  122.       General Remarks
  123.  
  124.       All functions return an integer code. Negative values are always
  125.       errors. See Section 11.3 "SEE Error Return Code List" in the
  126.       SEE/POP3 Users Manual (SEE4C_U.TXT). Non-negative return codes are
  127.       never errors.
  128.  
  129.       Note that the seeErrorText function is used to get the text message
  130.       associated with any error code.
  131.  
  132.  
  133.       SEE Functions
  134.  
  135.  
  136.       +----------+--------------------------------------------------------+
  137.       | seeClose | Closes SMTP/POP3 Email Engine.                         |
  138.       +----------+--------------------------------------------------------+
  139.  
  140.  
  141.         SYNTAX  int seeClose(void)
  142.  
  143.        REMARKS  The seeClose function closes the connection created by
  144.                 calling seeSmtpConnect or seePop3Connect. seeSmtpConnect or
  145.                 seePop3Connect can be called again to open a connection to
  146.                 another SMTP or POP3 server if desired.
  147.  
  148.                 SEE can not be connected to both the SMTP server and the
  149.                 POP3 server at the same time. Call seeClose to terminate
  150.                 the connection before connecting again.
  151.  
  152.        RETURNS  < 0 : An error has occurred. See the error list.
  153.  
  154.        EXAMPLE
  155.  
  156.                 // call after sending all email.
  157.  
  158.                 seeClose();
  159.  
  160.       ALSO SEE  seeSmtpConnect and seePop3Connect.
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.      SEE4C Reference Manual                                    Page 3
  181.  
  182.  
  183.       +----------+--------------------------------------------------------+
  184.       | seeDebug | Returns debug information.                             |
  185.       +----------+--------------------------------------------------------+
  186.  
  187.  
  188.         SYNTAX  int seeDebug(
  189.                       int Index,    // Command index.
  190.                       LPSTR Buffer, // Buffer to place text into.
  191.                       int BufLen)   // Length of above Buffer.
  192.  
  193.        REMARKS  The seeDebug function returns debug information depending
  194.                on the value of Index.
  195.  
  196.                       SEE_GET_REGISTRATION : Gets the registration string.
  197.                      SEE_GET_LAST_RESPONSE : Gets last server response.
  198.  
  199.        RETURNS  < 0 : An error has occurred. See the error list.
  200.  
  201.        EXAMPLE
  202.  
  203.                // Get the registration string from SEE16.DLL or SEE32.DLL.
  204.                char Buffer[128];
  205.                ...
  206.                seeDebug(SET_GET_REGISTRATION, (LPSTR)Buffer, 128);
  207.                printf("Registration: %s\n", Buffer);
  208.  
  209.                For more examples of use, refer to the SEEVER.C and the
  210.                VERUSR.C example programs.
  211.  
  212.       ALSO SEE  seeStatistics.
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.      SEE4C Reference Manual                                    Page 4
  241.  
  242.  
  243.       +-----------------+-------------------------------------------------+
  244.       | seeDecodeBuffer | Decodes buffer using BASE64.                    |
  245.       +-----------------+-------------------------------------------------+
  246.  
  247.  
  248.         SYNTAX  int seeDecodeBuffer(
  249.                       LPSTR CodedPtr,  // Buffer of BASE64 coded chars.
  250.                       LPSTR ClearPtr,  // Buffer to put decoded bytes.
  251.                       int Length)      // Length of above buffer.
  252.  
  253.        REMARKS  The seeDecodeBuffer function decodes the buffer 'CodedPtr'
  254.                of length 'Length' into 'ClearPtr', returning the length in
  255.                'ClearPtr'.
  256.  
  257.                The buffer 'CodedPtr' MUST contain BASE64 encoded text, as
  258.                created by seeEncodeBuffer.
  259.  
  260.                The buffer 'ClearPtr' will contain the ASCII or binary data
  261.                that was encoded.
  262.  
  263.        RETURNS  Number of bytes in ClearPtr.
  264.  
  265.        EXAMPLE
  266.  
  267.                #define CLEAR_SIZE 1000
  268.                #define CODED_SIZE 4*(CLEAR_SIZE/3)
  269.  
  270.                char ClearBuffOne[CLEAR_SIZE];
  271.                char ClearBuffTwo[CLEAR_SIZE];
  272.                char CodedBuff[CODED_SIZE];
  273.                int  Length;
  274.  
  275.                strcpy(ClearBuff,"SEE/POP3 Test.\r\nBye.\r\n");
  276.                Length = strlen(ClearBuffOne);
  277.  
  278.                /* BASE64 encode */
  279.                Length = seeEncodeBuff((LPSTR)ClearBuffOne,
  280.                                       (LPSTR)CodedBuff, Length);
  281.  
  282.                /* BASE64 decode */
  283.  
  284.                Length = seeDecodeBuff((LPSTR)CodedBuff,
  285.                                       (LPSTR)ClearBuffTwo, Length);
  286.  
  287.                /* ClearBuffTwo should have same text as ClearBuffOne */
  288.  
  289.       ALSO SEE  seeEncodeBuffer.
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.      SEE4C Reference Manual                                    Page 5
  301.  
  302.  
  303.       +----------------+--------------------------------------------------+
  304.       | seeDeleteEmail | Deletes email from Server.                       |
  305.       +----------------+--------------------------------------------------+
  306.  
  307.  
  308.         SYNTAX  int seeDeleteEmail(
  309.                       int MsgNbr)    // message number
  310.  
  311.  
  312.        REMARKS  The seeDeleteEmail function deletes the email numbered
  313.                 'MsgNbr' from the server.
  314.  
  315.                 After each email deletion by the POP3 server, all messages
  316.                 are renumbered, the first message being 1. Therefore,
  317.                 delete messages from highest to lowest to avoid having to
  318.                 recalculate message numbering.
  319.  
  320.                 For example, to delete messages 5, 6, and 7, message 7 is
  321.                 deleted first, then message 6, and lastly message 5.
  322.  
  323.                 Be careful! Once an email has been deleted from the
  324.                 server, it cannot be recovered.
  325.  
  326.        RETURNS  < 0 : An error has occurred. See the error list.
  327.  
  328.        EXAMPLE
  329.  
  330.                 int Code;
  331.                 . . .
  332.                 // delete message # 5 , # 6, and #7.
  333.                 Code = seeDeleteEmail(7);
  334.                 if(Code>=0) Code = seeDeleteEmail(6);
  335.                 if(Code>=0) Code = seeDeleteEmail(5);
  336.                 . . .
  337.  
  338.       ALSO SEE  seeGetEmailCount.
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.      SEE4C Reference Manual                                    Page 6
  361.  
  362.  
  363.       +-----------+-------------------------------------------------------+
  364.       | seeDriver | Executes next SEE state.                              |
  365.       +-----------+-------------------------------------------------------+
  366.  
  367.  
  368.         SYNTAX  int seeDriver(void)
  369.  
  370.        REMARKS  The seeDriver function executes the next state in the SEE
  371.                 state engine. The purpose of this function is to allow the
  372.                 programmer to get control after the driver executes each
  373.                 state.
  374.  
  375.                 The seeDriver function is explicitly called only after the
  376.                 AUTO_DRIVER_CALL flag has been disabled (see function
  377.                 seeIntegerParam). If the AUTO_DRIVER_CALL flag has not been
  378.                 disabled (the default), then seeDriver is never called.
  379.  
  380.                 Refer to the section 4.0 "Theory of Operation" in the
  381.                 SMTP/POP3 Users Manual for more details on the operation of
  382.                 seeDriver.
  383.  
  384.        RETURNS  = 0 : The driver is done.
  385.                 < 0 : An error has occurred. See the error list.
  386.                 > 0 : The returned value is the state just executed.
  387.  
  388.        EXAMPLE
  389.  
  390.                 int Code;
  391.                 . . .
  392.                 [call seeSmtpConnect]
  393.                 . . .
  394.                 // disable automatic calling of seeDriver().
  395.                 seeIntegerParam(AUTO_DRIVER_CALL, 0);
  396.                 Code = seeSendEmail(...);
  397.                 if(Code<0)
  398.                   {printf("Error %d\n", Code);
  399.                    exit(1);
  400.                   }
  401.                 while(1)
  402.                   {Code = seeDriver();
  403.                    if(Code<0)
  404.                      {printf("Error %d\n", Code);
  405.                       exit(1);
  406.                      }
  407.                    /* display all but "wait" state */
  408.                    if(Code!=9999) printf("%d ",Code);
  409.                    if(Code==0) return 0;
  410.                   }
  411.                }
  412.  
  413.       ALSO SEE  seeIntegerParam, seeSmtpConnect, and seePop3Connect.
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.      SEE4C Reference Manual                                    Page 7
  421.  
  422.  
  423.       +-----------------+-------------------------------------------------+
  424.       | seeEncodeBuffer | Encodes buffer using BASE64.                    |
  425.       +-----------------+-------------------------------------------------+
  426.  
  427.  
  428.         SYNTAX  int seeEncodeBuffer(
  429.                       LPSTR ClearPtr,  // Buffer of characters to encode.
  430.                       LPSTR CodedPtr,  // Buffer to put BASE64 encoded.
  431.                       int Length)      // Length of above.
  432.  
  433.        REMARKS  The seeEncodeBuffer function encodes 'ClearPtr' into
  434.                'CodedPtr' using Base-64 encoding.
  435.  
  436.                The 'ClearPtr' buffer may contain any ASCII or binary data.
  437.  
  438.                The 'CodedPtr' buffer will contain 7-bit ASCII data broken
  439.                into lines of 76 characters followed by a carriage return
  440.                '\r' and line feed '\n'. That is, 'CodedPtr' will contains
  441.                multiple lines.
  442.  
  443.        RETURNS  Number of bytes in CodedPtr.
  444.  
  445.        EXAMPLE
  446.  
  447.                #define CLEAR_SIZE 1000
  448.                #define CODED_SIZE 4*(CLEAR_SIZE/3)
  449.  
  450.                char ClearBuffOne[CLEAR_SIZE];
  451.                char ClearBuffTwo[CLEAR_SIZE];
  452.                char CodedBuff[CODED_SIZE];
  453.                int  Length;
  454.  
  455.                strcpy(ClearBuff,"SEE/POP3 Test.\r\nBye.\r\n");
  456.                Length = strlen(ClearBuffOne);
  457.  
  458.                /* BASE64 encode */
  459.                Length = seeEncodeBuff((LPSTR)ClearBuffOne,
  460.                                       (LPSTR)CodedBuff, Length);
  461.  
  462.                /* BASE64 decode */
  463.  
  464.                Length = seeDecodeBuff((LPSTR)CodedBuff,
  465.                                       (LPSTR)ClearBuffTwo, Length);
  466.  
  467.                /* ClearBuffTwo should have same text as ClearBuffOne */
  468.  
  469.       ALSO SEE  seeIntegerParam, seeSmtpConnect, and seePop3Connect.
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.      SEE4C Reference Manual                                    Page 8
  481.  
  482.  
  483.       +--------------+----------------------------------------------------+
  484.       | seeErrorText | Get text associated with error code.               |
  485.       +--------------+----------------------------------------------------+
  486.  
  487.  
  488.         SYNTAX  int seeErrorText(
  489.                       int Code,     // Error code returned by SEE function.
  490.                       LPSTR Buffer, // Buffer to place error text into.
  491.                       int BufLen)   // Length of above Buffer.
  492.  
  493.        REMARKS  The seeErrorText function is used to get the error text
  494.                 associated with an an error code as returned by one of the
  495.                 other SEE functions.
  496.  
  497.                 When an error occurs, seeErrorText can be used to get the
  498.                 error text so that it can be displayed for the user.
  499.  
  500.        RETURNS  < 0 : An error has occurred. See the error list.
  501.                 >=0 : Error message was copied into 'Buffer'.
  502.  
  503.        EXAMPLE
  504.  
  505.                 static char Buffer[80];
  506.  
  507.                 . . .
  508.  
  509.                 Code = seeSmtpConnect(
  510.                           "mail.myisp.net",   // SMTP server
  511.                           "<me@myisp.net>",   // your email address
  512.                           NULL);              // reply-to
  513.                 if(Code<0)
  514.                   {seeErrorText(Code,Buffer,80);
  515.                    printf("ERROR %d: %s\n", Code, Buffer);
  516.                    exit(1);
  517.                   }
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.      SEE4C Reference Manual                                    Page 9
  541.  
  542.  
  543.       +----------------+--------------------------------------------------+
  544.       | seeExtractText | Extract specified text from buffer.              |
  545.       +----------------+--------------------------------------------------+
  546.  
  547.  
  548.         SYNTAX  int seeExtractText(
  549.                       LPSTR Src,     // Text buffer to search.
  550.                       LPSTR Text,    // Text searching for.
  551.                       LPSTR Buffer,  // Buffer for line if found.
  552.                       int BufSize)   // Size of 'Buffer'.
  553.  
  554.        REMARKS  The seeExtractText function is used to search the text
  555.                 buffer 'Src' for text 'Text'. If found, the entire line is
  556.                 copied to 'Buffer', up to a maximum of 'BufSize' bytes.
  557.  
  558.                 The primary purpose of seeExtractText is to extract header
  559.                 lines from the buffer after calling seeGetEmailLines.
  560.  
  561.                 The seeExtractText does not require a connection to a SMTP
  562.                 or POP3 server.
  563.  
  564.                 For an example of use, see the STATUS and FROM sample
  565.                 programs.
  566.  
  567.        RETURNS  1 (TRUE) if 'Text' was found
  568.                 0 (FALSE) if 'Text' was not found.
  569.  
  570.        EXAMPLE
  571.  
  572.                 // search 'Source' for the line containing "From:"
  573.                 Code = seeExtractText((LPSTR)Source,(LPSTR)"From: ",
  574.                                       (LPSTR)Temp, 80);
  575.                 // print line if found
  576.                 if(Code>0) printf("%s\n", Temp);
  577.  
  578.       ALSO SEE  seeGetEmailLines.
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.      SEE4C Reference Manual                                    Page 10
  601.  
  602.  
  603.       +------------------+------------------------------------------------+
  604.       | seeGetEmailCount | Get number of email messages on server.        |
  605.       +------------------+------------------------------------------------+
  606.  
  607.  
  608.         SYNTAX  int seeGetEmailCount(void)
  609.  
  610.        REMARKS  The seeGetEmailCount function returns the number of
  611.                 messages waiting on the server, independent of whether
  612.                 they have been previously read.
  613.  
  614.                 If you have disabled the driver AUTO_CALL capability,
  615.                 the message count must be found by
  616.  
  617.                    Count = seeStatistics(SEE_GET_MSG_COUNT)
  618.  
  619.                 after calling seeDriver until it returns 0. Refer to the
  620.                 STAT and STATUS sample program for examples of use.
  621.  
  622.        RETURNS  < 0 : An error has occurred. See the error list
  623.                 >=0 : The number of email messages waiting (if AUTO_CALL
  624.                       was disabled).
  625.  
  626.        EXAMPLE
  627.  
  628.                 /* connect to POP3 server */
  629.                 Code = seePop3Connect(
  630.                    (LPSTR)"mail.myisp.net",   // POP3 server
  631.                    (LPSTR)"billbob",          // user
  632.                    (LPSTR)"xxx");             // password
  633.  
  634.                 /* get # messages waiting  */
  635.                 Code = seeGetEmailCount();
  636.                 printf("%d messages waiting\n",Code);
  637.  
  638.       ALSO SEE  seeGetEmailLines.
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.      SEE4C Reference Manual                                    Page 11
  661.  
  662.  
  663.       +-----------------+-------------------------------------------------+
  664.       | seeGetEmailFile | Read email message & save to a file.            |
  665.       +-----------------+-------------------------------------------------+
  666.  
  667.  
  668.         SYNTAX  int seeGetEmailFile(
  669.                       int MsgNbr,       // header #
  670.                       LPSTR EmailName,  // email filename
  671.                       LPSTR EmailDir,   // directory for email
  672.                       LPSTR AttachDir)  // directory for attachments
  673.  
  674.        REMARKS  The seeGetEmailFile reads the email message 'MsgNbr',
  675.                 saving it to disk as filename 'EmailName' in directory
  676.                 'EmailDir', and saving MIME attachments to directory
  677.                 'AttachDir'. The current directory is specified as '.'.
  678.  
  679.                 Specify a download directory when calling seeGetEmailFile
  680.                 so that you don't overwrite one of the files in the current
  681.                 directory.
  682.  
  683.  
  684.  
  685.        RETURNS  < 0 : An error has occurred. See the error list
  686.  
  687.        EXAMPLE
  688.  
  689.                 // Read message 1 and save as MYMAIL.TXT in
  690.                 //    current directory and attachments in C:\TEMP.
  691.                 // Note that backslashes are "doubled".
  692.  
  693.                 seeGetEmailFile(1, (LPSTR)"mymail.txt",
  694.                         (LPSTR)".", (LPSTR)"c:\\temp");
  695.  
  696.                 seeGetEmailFile(MsgNbr, MsgName,
  697.                         (LPSTR)".\\download", (LPSTR)".\\download");
  698.  
  699.       ALSO SEE  seeGetEmailLines.
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.      SEE4C Reference Manual                                    Page 12
  721.  
  722.  
  723.       +------------------+------------------------------------------------+
  724.       | seeGetEmailLines | Read lines from email message.                 |
  725.       +------------------+------------------------------------------------+
  726.  
  727.  
  728.         SYNTAX  int seeGetEmailLines(
  729.                       int MsgNbr,   // message #
  730.                       int Lines,    // # lines
  731.                       LPSTR Buffer, // Pointer to (static) Buffer
  732.                       int Size)     // size of buffer
  733.  
  734.  
  735.        REMARKS  The seeGetEmailLines function reads all header lines plus
  736.                 the number of body lines specified by the 'Lines' argument
  737.                 into 'Buffer', up to a maximum of 'Size' bytes.
  738.  
  739.                 The primary purpose of this function is to read the header
  740.                 lines without having to read the entire message.
  741.  
  742.                 If you have disabled the driver AUTO_CALL capability,
  743.                 the size must be found by
  744.  
  745.                    Count = seeStatistics(SEE_GET_BUFFER_COUNT)
  746.  
  747.                 after calling seeDriver until it returns 0.
  748.  
  749.                 See the STATUS and FROM sample code for examples of use.
  750.  
  751.        RETURNS  < 0 : An error has occurred. See the error list.
  752.                 >=0 : The number of bytes read (if AUTO_CALL
  753.                       was disabled).
  754.  
  755.        EXAMPLE
  756.  
  757.                 char Buffer[1024];
  758.                 . . .
  759.                 /* read header lines for email # 1 */
  760.                 Code = seeGetEmailLines(1,0,(LPSTR)Buffer,1024);
  761.  
  762.       ALSO SEE  seeGetEmailFile
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.      SEE4C Reference Manual                                    Page 13
  781.  
  782.  
  783.       +-----------------+-------------------------------------------------+
  784.       | seeGetEmailSize | Get size of email message in bytes.             |
  785.       +-----------------+-------------------------------------------------+
  786.  
  787.  
  788.         SYNTAX  long seeGetEmailSize(
  789.                        int MsgNbr)   // message number
  790.  
  791.  
  792.        REMARKS  The seeGetEmailSize function returns the size in bytes of
  793.                 the specified message # 'MsgNbr'.
  794.  
  795.                 seeGetEmailSize returns the size of the entire email
  796.                 message, including any attachments. Note that attachments
  797.                 will be encoded (MIME, UUENCODE, etc.), and thus take up
  798.                 more room than after they are decoded.
  799.  
  800.                 If you have disabled the driver AUTO_CALL capability,
  801.                 the size must be found by
  802.  
  803.                    Count = seeStatistics(SEE_GET_MSG_SIZE)
  804.  
  805.                 after calling seeDriver until it returns 0.
  806.  
  807.                 See the READER sample code for an example of use.
  808.  
  809.        RETURNS  < 0 : An error has occurred. See the error list
  810.                 >=0 : The size of the email in bytes on the server
  811.                       (if AUTO_CALL was disabled).
  812.  
  813.        EXAMPLE  long FileSize;
  814.                 . . .
  815.                 /* get size of email message # 3 */
  816.                 FileSize = seeGetEmailSize(3);
  817.  
  818.  
  819.       ALSO SEE  seeGetEmailCount.
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.      SEE4C Reference Manual                                    Page 14
  841.  
  842.  
  843.       +-----------------+-------------------------------------------------+
  844.       | seeIntegerParam | Sets SEE integer parameter.                     |
  845.       +-----------------+-------------------------------------------------+
  846.  
  847.  
  848.         SYNTAX  int seeIntegerParam(
  849.                       int ParmIndex,    // Parameter index (see below).
  850.                       ULONG ParmValue)  // Value of parameter to set.
  851.  
  852.        REMARKS The seeIntegerParam is used to set an integer parameter as
  853.                 defined in SEE.H. All times are in milliseconds.
  854.  
  855.                         Parameter Name     Default
  856.                  SEE_MIN_RESPONSE_WAIT  :  250
  857.                  SEE_MAX_RESPONSE_WAIT  :  25000
  858.                      SEE_MIN_LINE_WAIT  :  10
  859.                      SEE_MAX_LINE_WAIT  :  25000
  860.                       SEE_CONNECT_WAIT  :  60000
  861.                   SEE_QUOTED_PRINTABLE  :  0
  862.                   SEE_AUTO_CALL_DRIVER  :  1
  863.  
  864.                 SEE_MIN_RESPONSE_WAIT is the delay before looking for the
  865.                 server's response.
  866.  
  867.                 SEE_MAX_RESPONSE_WAIT is the time after which a "time-out"
  868.                 error occurs if the server has not responded.
  869.  
  870.                 SEE_MIN_LINE_WAIT is the delay before checking if the
  871.                 server is ready to accept the next line of input.
  872.  
  873.                 SEE_MAX_LINE_WAIT is the time after which a "time-out"
  874.                 error is declared if the server has not responded.
  875.  
  876.                 SEE_CONNECT_WAIT is the maximum time allowed to complete a
  877.                 connection to the SMTP server.
  878.  
  879.                 SEE_QUOTED_PRINTABLE controls whether messages are (1)
  880.                 or are not (0) encoded as quoted-printable.
  881.  
  882.                 SEE_AUTO_CALL_DRIVER controls whether seeDriver is called
  883.                 automatically (to completion) after seeSmtpConnect or
  884.                 seePop3Connect has been called.
  885.  
  886.        EXAMPLE
  887.  
  888.                 /* disable auto call feature */
  889.                 seeIntegerParam(SEE_AUTO_CALL_DRIVER, 0);
  890.  
  891.       ALSO SEE  seeStringParam.
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.      SEE4C Reference Manual                                    Page 15
  901.  
  902.  
  903.       +----------------+--------------------------------------------------+
  904.       | seePop3Connect | Connects to POP3 Server.                         |
  905.       +----------------+--------------------------------------------------+
  906.  
  907.  
  908.         SYNTAX  int seePop3Connect(
  909.                       LPSTR Pop3Ptr,    // POP3 server name
  910.                       LPSTR UserPtr,    // POP3 user name.
  911.                       LPSTR PassPtr)    // POP3 password.
  912.  
  913.        REMARKS  The seePop3Connect function establishes a connection with
  914.                 the POP3 server as specified by the Server argument.
  915.  
  916.                 Your POP3 server name will typically be named
  917.                 "mail.XXX.com" where XXX is your email address, such as
  918.                 name@XXX.com. Your POP3 server name can also be found in
  919.                 the setup information for your normal email client, such as
  920.                 Eudora or Microsoft Outlook.
  921.  
  922.                 The POP3 server name can also be specified in dotted
  923.                 decimal notation if wanted. For example "10.23.231.1".
  924.  
  925.                 SEE can not be connected to both the SMTP server and the
  926.                 POP3 server at the same time. Call seeClose to terminate
  927.                 the connection before connecting again.
  928.  
  929.        RETURNS  < 0 : An error has occurred. See the error list.
  930.  
  931.        EXAMPLE
  932.  
  933.                 int Code;
  934.                 Code = seePop3Connect(
  935.                           (LPSTR)"mail.myisp.com",  // POP3 server
  936.                           (LPSTR)"billbob",         // user
  937.                           (LPSTR)"xxx");            // password
  938.  
  939.       ALSO SEE  seeSmtpConnect and seeClose.
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.      SEE4C Reference Manual                                    Page 16
  961.  
  962.  
  963.       +--------------+----------------------------------------------------+
  964.       | seeSendEmail | Sends email and attachments.                       |
  965.       +--------------+----------------------------------------------------+
  966.  
  967.  
  968.         SYNTAX  int seeSendEmail(
  969.                       LPSTR To,     // Recipient, separated by commas.
  970.                       LPSTR CC,     // CC list, separated by commas.
  971.                       LPSTR BCC,    // BCC list, separated by commas.
  972.                       LPSTR Subj,   // Subject text.
  973.                       LPSTR Msg,    // Message or message filename.
  974.                       LPSTR Attach) // File attachment.
  975.  
  976.        REMARKS  The seeSendEmail function is used to send email once a
  977.                 connection has been made to your SMTP server after calling
  978.                 seeSmtpConnect.
  979.  
  980.                 Note that all email addresses (in To, CC, and BCC strings)
  981.                 must be bracketed. For example:
  982.  
  983.                      <mike@marshallsoft.com>
  984.  
  985.                 The CC and BCC strings may contain multiple email
  986.                 addresses, separated by commas. For example:
  987.  
  988.                    "Billy Bob<bbob@isp.com>,Buster<bm@isp.com>"
  989.  
  990.                 If the first character of the message (fifth argument) is
  991.                 a '@', then it is considered as the filename which contains
  992.                 the message to send.
  993.  
  994.                 'Attach' may contain one or more attachments, separated by
  995.                 commas. For example,
  996.  
  997.                    "file1.zip,file2.doc".
  998.  
  999.        RETURNS  < 0 : An error has occurred. See the error list.
  1000.  
  1001.        EXAMPLE
  1002.  
  1003.                 seeSendEmail("<myfriend@hisisp.com>",  /* recipient */
  1004.                            NULL,                       /* CC list */
  1005.                            NULL,                       /* BCC list */
  1006.                            "Hello",                    /* subject */
  1007.                            "Call me ASAP!",            /* message */
  1008.                            NULL);                      /* attachment */
  1009.  
  1010.  
  1011.       ALSO SEE  seeSmtpConnect.
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.      SEE4C Reference Manual                                    Page 17
  1021.  
  1022.  
  1023.       +----------------+--------------------------------------------------+
  1024.       | seeSmtpConnect | Connects to SMTP server.                         |
  1025.       +----------------+--------------------------------------------------+
  1026.  
  1027.  
  1028.         SYNTAX  int seeSmtpConnect(
  1029.                       LPSTR Server,  // SMTP server.
  1030.                       LPSTR From,    // Your email address in brackets.
  1031.                       LPSTR ReplyTo) // Email address to reply to.
  1032.  
  1033.        REMARKS  The seeSmtpConnect function establishes a connection with
  1034.                 the SMTP server as specified by the 'Server' argument.
  1035.  
  1036.                 Your SMTP server name will typically be named
  1037.                 "mail.XXX.com" where XXX is your email address, such as
  1038.                 name@XXX.com. Your SMTP server name can also be found in
  1039.                 the setup information for your normal email client, such as
  1040.                 Eudora or Microsoft Outlook.
  1041.  
  1042.                 The SMTP server name can also be specified in dotted
  1043.                 decimal notation if wanted. For example "10.23.231.1".
  1044.  
  1045.                 The 'From' string is required and must be enclosed in "<>"
  1046.                 brackets, such as <mike@marshallsoft.com>.
  1047.  
  1048.                 The 'ReplyTo' string is optional and is used for the
  1049.                 "Reply-To:" header line. If used, the email address must be
  1050.                 enclosed in "<>" brackets.
  1051.  
  1052.                 SEE can not be connected to both the SMTP server and the
  1053.                 POP3 server at the same time. Call seeClose to terminate
  1054.                 the connection before connecting again.
  1055.  
  1056.        RETURNS < 0 : An error has occurred. See the error list.
  1057.  
  1058.        EXAMPLE
  1059.  
  1060.                 seeSmtpConnect("mail.myisp.com",   // my SMTP server
  1061.                                "<me@myisp.com>",   // my email address
  1062.                                NULL);              // no Reply-To
  1063.  
  1064.                 seeSmtpConnect("mail.myisp.com",   // my SMTP server
  1065.                                "<me@myisp.com>",   // my email address
  1066.                                "<him@himisp.com>); // Reply-To address
  1067.  
  1068.       ALSO SEE  seeClose.
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.      SEE4C Reference Manual                                    Page 18
  1081.  
  1082.  
  1083.       +---------------+---------------------------------------------------+
  1084.       | seeStatistics | Returns runtime statistics.                       |
  1085.       +---------------+---------------------------------------------------+
  1086.  
  1087.  
  1088.         SYNTAX  ULONG seeStatistics(
  1089.                         int Index)   // Specifies which statistic.
  1090.  
  1091.        REMARKS  The seeStatistics function is used to return runtime
  1092.                 statistics in the SEE DLL. The values of 'Index' are
  1093.                 defined in SEE.H as follows:
  1094.  
  1095.                            SEE_GET_VERSION : Gets the SEE version number.
  1096.                         SEE_GET_SOCK_ERROR : Gets last socket error.
  1097.                            SEE_GET_COUNTER : Gets # times driver called.
  1098.                           SEE_GET_RESPONSE : Gets last SMTP response code.
  1099.                 SEE_GET_MESSAGE_BYTES_READ : Gets # message bytes read.
  1100.                  SEE_GET_ATTACH_BYTES_READ : Gets # attachment bytes read.
  1101.                   SEE_GET_TOTAL_BYTES_READ : Gets total of above two.
  1102.                 SEE_GET_MESSAGE_BYTES_SENT : Gets # message bytes sent.
  1103.                  SEE_GET_ATTACH_BYTES_SENT : Gets # attachment bytes sent.
  1104.                   SEE_GET_TOTAL_BYTES_SENT : Gets total of above two.
  1105.                          SEE_GET_MSG_COUNT : Gets # emails waiting.
  1106.                           SEE_GET_MSG_SIZE : Gets size of email.
  1107.                       SEE_GET_BUFFER_COUNT : Gets # bytes in buffer for
  1108.                                              seeGetEmailLines.
  1109.                     SEE_GET_CONNECT_STATUS : Returns TRUE if connected.
  1110.                      SEE_GET_VERIFY_STATUS : Returns seeVerifyUser status.
  1111.                       SEE_GET_ATTACH_COUNT : Gets # attachments received.
  1112.  
  1113.                 The number of message bytes sent will usually be larger
  1114.                 than your message size because of SMTP protocol overhead.
  1115.  
  1116.                 The number of attachment bytes sent will be at least
  1117.                 one-third larger than the actual attachment since every 3
  1118.                 bytes are encoded as 4 7-bit ASCII bytes before being
  1119.                 transmitted.
  1120.  
  1121.                 The purpose of "...BYTES_READ" and "...BYTES_SENT" is to
  1122.                 provide the ability to track the transmission progress of
  1123.                 large messages and attachments. See the READER example
  1124.                 program.
  1125.  
  1126.        EXAMPLE
  1127.  
  1128.                 // get total message & attachment bytes transmitted.
  1129.  
  1130.                 Code = seeStatistics(SEE_GET_TOTAL_BYTES_SENT);
  1131.  
  1132.       ALSE SEE  seeDebug, seeIntegerParam, and seeStringParam.
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.      SEE4C Reference Manual                                    Page 19
  1141.  
  1142.  
  1143.       +----------------+--------------------------------------------------+
  1144.       | seeStringParam | Sets SEE string parameter.                       |
  1145.       +----------------+--------------------------------------------------+
  1146.  
  1147.  
  1148.         SYNTAX  int seeStringParam(
  1149.                       int ParamName,      // Index of parameter.
  1150.                       LPSTR ParamString)  // Parameter string.
  1151.  
  1152.        REMARKS  The seeStringParam function is used to set a string
  1153.                 parameter as defined in SEE.H.
  1154.  
  1155.                 SEE_LOG_FILE : Specifies the log filename.
  1156.  
  1157.                 The log file is used to debug a SMTP or POP3 session. Be
  1158.                 advised that log files can be quite large. Don't use them
  1159.                 unless necessary.
  1160.  
  1161.        EXAMPLE
  1162.  
  1163.                seeStringParam(SEE_LOG_FILE, "mytest.log");
  1164.  
  1165.       ALSO SEE  seeIntegerParam.
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.      SEE4C Reference Manual                                    Page 20
  1201.  
  1202.  
  1203.       +-----------------+-------------------------------------------------+
  1204.       | seeVerifyFormat | Check email address format.                     |
  1205.       +-----------------+-------------------------------------------------+
  1206.  
  1207.  
  1208.         SYNTAX  int seeVerifyFormat(
  1209.                       LPSTR String)   // Email address to check.
  1210.  
  1211.        REMARKS  The seeVerifyFormat function is used to test an individual
  1212.                 email address for proper formatting. If this function
  1213.                 returns 0 or above, then the email address is properly
  1214.                 formatted. But, if this function returns a negative value,
  1215.                 the email address is either badly formatted, or it uses
  1216.                 characters (such as '%') that are not normally used as part
  1217.                 of an email address.
  1218.  
  1219.                 Note that left and right brackets ('<' and '>') must
  1220.                 surround the email address.
  1221.  
  1222.        EXAMPLE
  1223.  
  1224.                 static char Buffer[80];
  1225.  
  1226.                 . . .
  1227.  
  1228.                 Code = seeVerifyFormat("Billy E. Bob<beb@hisasp.com>");
  1229.                 if(Code<0)
  1230.                   {seeErrorText(Code,Buffer,80);
  1231.                    printf("Email address error : %s\n", Buffer);
  1232.                    exit(1);
  1233.                   }
  1234.  
  1235.       ALSO SEE  seeErrorText and seeVerifyUser.
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.      SEE4C Reference Manual                                    Page 21
  1261.  
  1262.  
  1263.       +---------------+---------------------------------------------------+
  1264.       | seeVerifyUser | Verify email address.                             |
  1265.       +---------------+---------------------------------------------------+
  1266.  
  1267.  
  1268.         SYNTAX  int seeVerifyUser(
  1269.                       LPSTR String)   // Email address to verify.
  1270.  
  1271.        REMARKS  The seeVerifyUser function is used to verify an individual
  1272.                email address with the email server which "owns" the email
  1273.                address.
  1274.  
  1275.                seeVerify will connect to the specified server and request
  1276.                verification of the user. Some SMTP servers may refuse
  1277.                connection of any client not directly connected to them or
  1278.                may refuse all "verify user" requests. Web based email
  1279.                servers such as hotmail.com may refuse all SMTP connections.
  1280.  
  1281.                Note that you connect to the remote SMTP server rather than
  1282.                the SMTP server that you use to send email.
  1283.  
  1284.                For example, to verify msc@traveller.com, you must first
  1285.                connect to the SMTP server "mail.traveller.com" then call
  1286.                SeeVerifyUser((LPSTR)"msc").
  1287.  
  1288.                Refer to VERUSR.C for an example of the seeVerifyUser
  1289.                function.
  1290.  
  1291.        EXAMPLE
  1292.  
  1293.                 static char Buffer[80];
  1294.                 static char *SmtpServer = "mail.traveller.com";
  1295.                 static char *Userptr = "msc";
  1296.                 . . .
  1297.  
  1298.                 Code = seeSmtpConnect((LPSTR)SmtpServer, ...);
  1299.                 . . .
  1300.                 Code = seeVerifyUser((LPSTR)UserPtr);
  1301.                 if(Code==0)
  1302.                   {/* display last server response */
  1303.                    seeDebug(SEE_GET_LAST_RESPONSE, (LPSTR)Buffer, 128);
  1304.                    printf("NOT verified (%s).\n",Buffer);
  1305.                   }
  1306.                 else printf("verified.\n");
  1307.  
  1308.       ALSO SEE  seeErrorText and seeDebug.
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.      SEE4C Reference Manual                                    Page 22
  1321.  
  1322.